package org.util;

import org.util.StringTokenizer;
/**
 *
 * @author German Garcia
 */
public class Util {
    public static String[] split(String src, String delimiter) {
        int size = 0;
        String retval[] =  null;
        StringTokenizer tokens = new StringTokenizer(src, delimiter);
        while(tokens.hasMoreTokens()) {
            tokens.nextToken();
            size++;
        }
        if(size==0) {
            retval = new String[1];
            retval[0] = src;
        } else {
            retval = new String[size];
            size = 0;
            tokens = new StringTokenizer(src, delimiter);
            while(tokens.hasMoreTokens()) retval[size++] = tokens.nextToken();
        }
        return retval;
    }
}
